﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using DungeonAndDragonApplication.Controller.Game.UserInformation;
using System.Windows.Forms;
using ADNDNetwork;


namespace DungeonAndDragonApplication
{
    public partial class Form1 : Form
    {

        #region DELEGATES

        public delegate string GetInfoDelegate();
        public delegate void StartGameDelegate(UserType ut);
        public delegate void SendMessageDelegate(AdndMessage message);
        public delegate string ReceiveMessageDelegate(string message);

        public delegate void ReceivedMessageDelegate(string receivedMessage);
        #endregion

        #region EVENTS

        public event GetInfoDelegate getInfo_Event;
        public event StartGameDelegate startGame_Event;
        public event SendMessageDelegate sendMessage_Event;
        public event ReceiveMessageDelegate receiveMessage_Event;

        public event ReceivedMessageDelegate ReceivedMessage_Event;
        #endregion

        public Form1()
        {
            InitializeComponent();
        }

        public void TestConn()
        {
            string s = getInfo_Event();
            startGame_Event(UserType.DungeonMaster);
            startGame_Event(UserType.Player);

            startGame_Event((UserType)4);
        }

        private void btnSend_Click(object sender, EventArgs e)
        {
            AdndMessage m = new AdndMessage() 
            {
                Body = tbSendMessage.Text,
                To = new string[] {"To Server"},
                From = new string[] {"Client"}
            };
            
            sendMessage_Event(m);

            tbSendMessage.Text = string.Empty;
        }



        public void update(string message)
        { 
        
        }
    }
}
